import { getChannelAPI } from "@/api/channel"
import type { ChannelItem } from "@/types"
import { onMounted, ref } from "vue"

export const useChannels = () => {
    const channelList = ref<ChannelItem[]>([])
const activeId = ref(0)
onMounted(() => {
  getchannelList()
})
const getchannelList =async () => {
  const result = await getChannelAPI()
  channelList.value = result.channels
  activeId.value=result.channels[0].id
}

    return {channelList,activeId}
}